/*
 * Copyright (C) 2010-2012 Susanta Tewari
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.cef.command.listener;

import cef.command.Command;
import cef.command.listener.CommandOutputEvent;
import cef.command.listener.CommandOutputListener;
import cef.command.listener.CommandOutputListenerException;
import cef.command.listener.FigureEditorOutputComponent;
import genomemap.cef.command.DrawContigMap_Cmd;

/**
 * @author Susanta Tewari
 * @history Created on Sep 5, 2012.
 */
public class DrawContigMap_OC extends FigureEditorOutputComponent {

    /**
     * Method description
     *
     *
     * @param cmdEvent
     *
     * @throws CommandOutputListenerException
     */
    @Override
    public void initComponents(final CommandOutputEvent cmdEvent)
            throws CommandOutputListenerException {

        title = "Contig Map";

        if (cmdEvent.getSource() instanceof DrawContigMap_Cmd) {

            final DrawContigMap_Cmd command = (DrawContigMap_Cmd) cmdEvent.getSource();

            this.figure = command.getContigMap();
        }
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public Class<? extends Command> getTargetCommandClass() {
        return DrawContigMap_Cmd.class;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public CommandOutputListener newInstance() {
        return new DrawContigMap_OC();
    }
}
